package extreme.tddscaffold;

public class Goods {
    private int sellIn;
    private int quality;
    private final String name;

    public Goods(int sellIn, int quality, String name) {
        this.sellIn = sellIn;
        this.quality = quality;
        this.name = name;
    }

    public int getSellIn() {
        return sellIn;
    }

    public void setSellIn(int sellIn) {
        this.sellIn = sellIn;
    }

    public int getQuality() {
        return quality;
    }

    public void setQuality(int quality) {
        this.quality = quality;
    }

    public String getName() {
        return name;
    }

    public void updateGoodsInfo(){
        GoodsTypeEnum goodsTypeEnum = GoodsTypeEnum.valueOf(name);
        sellIn = sellIn - 1;
        quality = goodsTypeEnum.getCurrentQuality(sellIn, quality);
    }

    @Override
    public String toString() {
        return "Goods{" +
                "sellIn=" + sellIn +
                ", quality=" + quality +
                ", name='" + name + '\'' +
                '}';
    }
}
